<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——开发板出厂系统烧写的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写">
<meta property="og:url" content="https://sumumm.github.io/post/c60bf741.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——开发板出厂系统烧写的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715103111652.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715103525312.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104000364.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104233134.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104422842.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104548266.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715105252434.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715105458720.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715111326712.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715112450883.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715112729155.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715113037813.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715113606940.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715114548282.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715132327384.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715132943564.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715133500709.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715133925204.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715161559248.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715161837580.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715162450581.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715162650620.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715163114529.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715163349191.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164046712.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164340236.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164749796.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715165016888.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072256965.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072427363.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072633479.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072801579.png">
<meta property="article:published_time" content="2023-09-08T11:25:28.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.031Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV01-IMX6ULL平台">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715103111652.png">


<link rel="canonical" href="https://sumumm.github.io/post/c60bf741.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/c60bf741.html","path":"post/c60bf741.html","title":"LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81mfgtool-%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%EF%BC%88OTG-%E6%96%B9%E5%BC%8F%EF%BC%89"><span class="nav-text">一、mfgtool 烧写系统（OTG 方式）  </span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="nav-text">1. 准备工作</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E5%BC%80%E5%8F%91%E6%9D%BF%E9%85%8D%E7%BD%AE"><span class="nav-text">1.1 开发板配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E8%B5%84%E6%96%99%E5%87%86%E5%A4%87"><span class="nav-text">1.2 资料准备</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0-TF%E5%8D%A1"><span class="nav-text">2. 烧写系统到 TF卡  </span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-vbs%E8%84%9A%E6%9C%AC%E9%80%89%E6%8B%A9"><span class="nav-text">2.1 vbs脚本选择</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E8%BF%90%E8%A1%8C%E7%83%A7%E5%86%99%E5%B7%A5%E5%85%B7"><span class="nav-text">2.2 运行烧写工具</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E5%90%AF%E5%8A%A8%E6%B5%8B%E8%AF%95"><span class="nav-text">2.3 启动测试</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%83%A7%E5%86%99%E5%88%B0eMMC"><span class="nav-text">3. 烧写到eMMC</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E7%83%A7%E5%86%99%E5%88%B0NAND"><span class="nav-text">4. 烧写到NAND</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81shell%E8%84%9A%E6%9C%AC%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F"><span class="nav-text">二、shell脚本烧写系统</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C-1"><span class="nav-text">1. 准备工作</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-ubuntu"><span class="nav-text">1.1 ubuntu</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E6%96%87%E4%BB%B6%E6%8B%B7%E8%B4%9D"><span class="nav-text">1.2 文件拷贝</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F%E5%88%B0TF%E5%8D%A1"><span class="nav-text">2. 烧写系统到TF卡</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E6%8C%82%E8%BD%BDTF%E5%8D%A1%E5%88%B0ubuntu"><span class="nav-text">2.1 挂载TF卡到ubuntu</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-imx6mksdboot-sh%E8%84%9A%E6%9C%AC"><span class="nav-text">2.2 imx6mksdboot.sh脚本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-TF%E5%8D%A1%E4%B8%AD%E9%83%BD%E7%83%A7%E5%86%99%E4%BA%86%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-text">2.3 TF卡中都烧写了什么？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-%E6%96%AD%E5%BC%80TF%E5%8D%A1"><span class="nav-text">2.4 断开TF卡</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-%E9%87%8D%E5%90%AF%E6%B5%8B%E8%AF%95"><span class="nav-text">2.5 重启测试</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%83%A7%E5%86%99%E5%88%B0eMMC-1"><span class="nav-text">3. 烧写到eMMC</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E5%87%86%E5%A4%87TF%E5%90%AF%E5%8A%A8%E7%B3%BB%E7%BB%9F"><span class="nav-text">3.1 准备TF启动系统</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E5%9C%A8ubuntu%E4%B8%8B%E6%8B%B7%E8%B4%9D%E6%89%80%E9%9C%80%E6%96%87%E4%BB%B6"><span class="nav-text">3.2 在ubuntu下拷贝所需文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E4%BB%8ETF%E5%8D%A1%E5%90%AF%E5%8A%A8%E5%BC%80%E5%8F%91%E6%9D%BF"><span class="nav-text">3.3 从TF卡启动开发板</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-4-imx6mkemmcboot-sh%E8%84%9A%E6%9C%AC"><span class="nav-text">3.4 imx6mkemmcboot.sh脚本</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-1-%E8%84%9A%E6%9C%AC%E8%AF%B4%E6%98%8E"><span class="nav-text">3.4.1 脚本说明</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-2-%E6%9F%A5%E7%9C%8BeMMC%E6%8C%82%E8%BD%BD%E8%8A%82%E7%82%B9"><span class="nav-text">3.4.2 查看eMMC挂载节点</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-3-%E7%83%A7%E5%86%99%E7%B3%BB%E7%BB%9F"><span class="nav-text">3.4.3 烧写系统</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-5-eMMC%E4%B8%AD%E9%83%BD%E7%83%A7%E5%86%99%E4%BA%86%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-text">3.5 eMMC中都烧写了什么？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-6-%E9%87%8D%E5%90%AF%E6%B5%8B%E8%AF%95"><span class="nav-text">3.6 重启测试</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E7%83%A7%E5%86%99%E5%88%B0NAND"><span class="nav-text">6. 烧写到NAND</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1-%E5%87%86%E5%A4%87TF%E5%90%AF%E5%8A%A8%E7%B3%BB%E7%BB%9F"><span class="nav-text">6.1 准备TF启动系统</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2-MTD-%E5%88%86%E5%8C%BA%E8%A1%A8"><span class="nav-text">6.2 MTD 分区表  </span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3-imx6mknandboot-sh-%E8%84%9A%E6%9C%AC"><span class="nav-text">6.3 imx6mknandboot.sh 脚本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4-%E9%87%8D%E5%90%AF%E6%B5%8B%E8%AF%95"><span class="nav-text">6.4 重启测试</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-shell%E8%84%9A%E6%9C%AC%E5%88%86%E6%9E%90"><span class="nav-text">4. shell脚本分析</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-imx6mksdboot-sh"><span class="nav-text">4.1 imx6mksdboot.sh</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-imx6mkemmcboot-sh"><span class="nav-text">4.2 imx6mkemmcboot.sh</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-3-imx6mknandboot-sh"><span class="nav-text">4.3 imx6mknandboot.sh</span></a></li></ol></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/c60bf741.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-09-08 19:25:28" itemprop="dateCreated datePublished" datetime="2023-09-08T19:25:28+08:00">2023-09-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">LV01-IMX6ULL平台</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>12k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>44 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——开发板出厂系统烧写的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.6的64位版本（一开始使用的是16.04版本，后来进行了升级）</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.0.0 build-20800274</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="4">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">在线阅读linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP linux内核仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr></table>
              </div>
            </details>

<p>前边我们已经了解过如何改造自己的mfgtool，以及如何通过mfgtool烧写系统，接下来就是用正点原子的开发板出厂系统来做烧写测试，后边也方便了解开发板功能。</p>
<h1 id="一、mfgtool-烧写系统（OTG-方式）"><a href="#一、mfgtool-烧写系统（OTG-方式）" class="headerlink" title="一、mfgtool 烧写系统（OTG 方式）  "></a><font size=3>一、mfgtool 烧写系统（OTG 方式）  </font></h1><h2 id="1-准备工作"><a href="#1-准备工作" class="headerlink" title="1. 准备工作"></a><font size=3>1. 准备工作</font></h2><h3 id="1-1-开发板配置"><a href="#1-1-开发板配置" class="headerlink" title="1.1 开发板配置"></a><font size=3>1.1 开发板配置</font></h3><p>确保前边的CH340驱动和串口终端都已经安装好了，然后ALPHA开发板按如下方式连接：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715103111652.png" alt="image-20230715103111652" style="zoom:50%;" />

<p>我们需要将底板拨码开关 BOOT_CFG 拨到对应的位置如上图，<strong>设置为 USB 连接方式</strong>，“1”代码 ON， “0”代表“OFF”。将拨码数字 2 处拨到 ON，其他的为 OFF。这样后面烧写才能正常识别到USB，最终将程序烧写到哪里，是在启动mfgtool工具的时候所选用的脚本来决定。</p>
<h3 id="1-2-资料准备"><a href="#1-2-资料准备" class="headerlink" title="1.2 资料准备"></a><font size=3>1.2 资料准备</font></h3><p>我们要烧写正点原子出厂系统，所以用的都是正点原子资料中的工具，我们主要使用 【开发板光盘 A-基础资料&#x2F;05、开发工具&#x2F;04、正点原子MFG_TOOL 出厂固件烧录工具&#x2F;mfgtool 】  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715103525312.png" alt="image-20230715103525312" style="zoom:50%;" />

<p>目前正点原子在售的核心板类型只有两种，一种是 eMMC（8GB）核心板类型， DDR 大小为 512MB。 另一种是 NandFlash（512MB）， DDR 大小为 256MB。 以 Mfgtool2-eMMC-ddr512-eMMC.vbs 为例，vbs 脚本命名解释如下：</p>
<blockquote>
<p>-eMMC：代表核心板上的存储介质为 eMMC</p>
<p>-ddr512： 指核心板上的 DDR 大小为 512MB</p>
<p>-eMMC： 选择此脚本是把固件烧写到 eMMC 上  </p>
</blockquote>
<h2 id="2-烧写系统到-TF卡"><a href="#2-烧写系统到-TF卡" class="headerlink" title="2. 烧写系统到 TF卡  "></a><font size=3>2. 烧写系统到 TF卡  </font></h2><h3 id="2-1-vbs脚本选择"><a href="#2-1-vbs脚本选择" class="headerlink" title="2.1 vbs脚本选择"></a><font size=3>2.1 vbs脚本选择</font></h3><p>首先需要准备一张 TF 卡， 按前面的 vbs 脚本命名解释， 比如要烧写系统到 TF(SD Card)卡，那么需要确认我们手上的核心板类型是 eMMC 还是NandFlash。 比如现在我手上核心板类型为 eMMC 类型核心板（512MB）。所以我就需要选择 Mfgtool2-eMMC-ddr512-SDCard.vbs 这个脚本来烧写 ，如果手上核心板类型 NandFlash 核心板，则选择 Mfgtool2-NAND-ddr256-SDCard.vbs。 </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104000364.png" alt="image-20230715104000364" style="zoom:50%;" />

<h3 id="2-2-运行烧写工具"><a href="#2-2-运行烧写工具" class="headerlink" title="2.2 运行烧写工具"></a><font size=3>2.2 运行烧写工具</font></h3><p>开发板上电， 我们双击 Mfgtool2-eMMC-ddr512-SDCard.vbs。如果是第一次使用开发板 OTG 连接 PC机（电脑），需要等待 PC（电脑） 机自动安装驱动。 点击右下角正在安装驱动的小图标， 注意不要让 Winodws 去从 Windows update 里去找驱动，点击跳过， 驱动自然会装上。否则用了 Windows update 里的驱动，可能在烧写过程中会卡住。 等待安装驱动完成后， mfgtool 界面会提示【符合HID标准的供应商定义设备】， 注意不要打开虚拟机，如果虚拟机正在开启， OTG 会连接到虚拟机上去。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104233134.png" alt="image-20230715104233134" style="zoom:50%;" />

<p>此时将 TF 卡插入卡槽（需开发板先上电后再将 TF 卡插进卡槽，否则上电时会检测 TF 卡，这样 mfgtool 会连接不到开发板设备）  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104422842.png" alt="image-20230715104422842" style="zoom:60%;" />

<p>然后点击【start】即可开始烧写系统，烧写过程中如下图：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715104548266.png" alt="image-20230715104548266" style="zoom:50%;" />

<p>烧写是一个很漫长的过程，主要是后边根文件系统的拷贝过程（如果说连接了串口的话，是可以看到串口有大量的打印信息，那些就是正在烧写的过程信息）。烧写完成后如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715105252434.png" alt="image-20230715105252434" style="zoom:50%;" />

<p>最后点击【Stop】&rarr;【Exit】退出即可。</p>
<h3 id="2-3-启动测试"><a href="#2-3-启动测试" class="headerlink" title="2.3 启动测试"></a><font size=3>2.3 启动测试</font></h3><p>测试从 SD 卡启动系统，拨码开关拨至 SD 卡启动方式 10000010，启动系统即可。启动成功我们可以看到正点原子的出厂系统，并且可以串口可以操作linux系统：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715105458720.png" alt="image-20230715105458720" style="zoom:50%;" />

<h2 id="3-烧写到eMMC"><a href="#3-烧写到eMMC" class="headerlink" title="3. 烧写到eMMC"></a><font size=3>3. 烧写到eMMC</font></h2><p>这个需要我们的核心板类型带 eMMC 存储介质。我使用的是eMMC核心板的ddr大小为512MB，所以双击 Mfgtool2-eMMC-ddr512-eMMC.vbs 这个 vbs 脚本文件进行烧写即可。和烧写到SD卡的步骤一模一样（这个时候就不要插入SD卡啦），当烧写完成后，将拨码开关拨至 eMMC 启动方式 10100110，启动系统即可。</p>
<h2 id="4-烧写到NAND"><a href="#4-烧写到NAND" class="headerlink" title="4. 烧写到NAND"></a><font size=3>4. 烧写到NAND</font></h2><p>使用前提:核心板类型带 NAND FLASH 存储介质。 若是使用的 NAND FLASH 核心板是 ddr 大小是 256MB，可以双击 Mfgtool2-NAND-ddr256-NAND.vbs 这个 vbs 脚本文件进行烧写。和烧写到SD卡的步骤一模一样（这个时候就不要插入SD卡啦），当烧写完成后，将拨码开关拨至 NAND 启动方式 10001001，启动系统即可。  </p>
<h1 id="二、shell脚本烧写系统"><a href="#二、shell脚本烧写系统" class="headerlink" title="二、shell脚本烧写系统"></a><font size=3>二、shell脚本烧写系统</font></h1><p>脚本烧写系统一般可用于批量烧写与升级系统， 不像 mfgtool 上位机那样还需要 PC 机和USB T 字口数据线，且每次只能打开一个 mfgtool 上位机，我们可以自行修改好烧写系统脚本，进行自动化烧写测试，那么可以无需专业人员参与，即可批量烧写系统。我们可以先对之前的SD卡进行格式化，然后我们通过脚本再将系统内核刷入SD卡。</p>
<p>格式化的时候建议使用SDFormatter去格式化吧，反正我用电脑格式化的话，好像只是格式化了一掉部分，并没有完全格式化。</p>
<h2 id="1-准备工作-1"><a href="#1-准备工作-1" class="headerlink" title="1. 准备工作"></a><font size=3>1. 准备工作</font></h2><h3 id="1-1-ubuntu"><a href="#1-1-ubuntu" class="headerlink" title="1.1 ubuntu"></a><font size=3>1.1 ubuntu</font></h3><p>通过脚本烧写的话，就需要用到虚拟机啦，我这里用的是VMware下的ubuntu22.04版本（后来我换回ubuntu16.04了，问题少，但是后来发现vscode的一个远程插件快要不支持16.04了，所以又撞了个20.04，但是这里这些图都没换）。</p>
<h3 id="1-2-文件拷贝"><a href="#1-2-文件拷贝" class="headerlink" title="1.2 文件拷贝"></a><font size=3>1.2 文件拷贝</font></h3><p>我们要烧写正点原子出厂系统，需要将 OS Firmware&#x2F;files 下的所有文件拷贝到ubuntu去，完整的路径如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">开发板光盘 A-基础资料/05、开发工具/04、正点原子MFG_TOOL 出厂固件烧录具/mfgtool/Profiles/Linux/OS Firmware/files</span><br></pre></td></tr></table></figure>

<p> 拷贝完成后如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715111326712.png" alt="image-20230715111326712" style="zoom:50%;" />

<h2 id="2-烧写系统到TF卡"><a href="#2-烧写系统到TF卡" class="headerlink" title="2. 烧写系统到TF卡"></a><font size=3>2. 烧写系统到TF卡</font></h2><h3 id="2-1-挂载TF卡到ubuntu"><a href="#2-1-挂载TF卡到ubuntu" class="headerlink" title="2.1 挂载TF卡到ubuntu"></a><font size=3>2.1 挂载TF卡到ubuntu</font></h3><p>我们插入TF卡，然后点击【虚拟机】&rarr;【可移动设备】&rarr;【设备名称】&rarr;【连接（断开与主机的连接）】</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715112450883.png" alt="image-20230715112450883" style="zoom:50%;" />

<p>这里的设备名称一般我们可以拔掉TF卡，然后再插上，看一下多了哪一个，就就知道我们的TF卡对应哪一个名称啦。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715112729155.png" alt="image-20230715112729155" style="zoom:50%;" />

<p>若是加载成功，一般会有这个图标出来，然后我们输入如下指令查看 SD 卡挂载节点，如下图， 写笔记的时候用的 TF 卡容量是 32GB，但实际会比这小一些。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo fdisk -l</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715113037813.png" alt="image-20230715113037813" style="zoom:50%;" />

<p>可以看到实际的容量大概就是29.44GB，挂载节点为 &#x2F;dev&#x2F;sdc 。</p>
<blockquote>
<ul>
<li>节点命名规则？</li>
</ul>
<p>节点的命名和Linux系统的磁盘命名有关系。Linux 使用一种更灵活的命名方案。它所传达的信息比其它操作系统采用的命名方案更多。该命名方案是基于文件的，文件名的格式为：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/dev/xxyn</span><br></pre></td></tr></table></figure>

<p>（1）&#x2F;dev&#x2F;： 这是所有设备文件所在的目录名。因为分区在硬盘上，而硬盘是设备，所以这些文件代表了在&#x2F;dev&#x2F;上所有可能的分区。</p>
<p>（2）xx：分区名的前两个字母标明分区所在设备的类型。通常是 hd （IDE 磁盘）或 sd（SCSI 磁盘）。</p>
<p>（3）y：这个字母标明分区所在第几个设备。例如，&#x2F;dev&#x2F;hda（第一个 IDE 磁盘）或 &#x2F;dev&#x2F;sdb（第二个 SCSI 磁盘）</p>
<p>（4）n：:最后的数字代表分区。前四个分区（主分区或扩展分区）是用数字从 1 排列到 4。逻辑分区从 5 开始。例如，&#x2F;dev&#x2F;hda3 是在第一个 IDE 硬盘上的第三个主分区或扩展分区；&#x2F;dev&#x2F;sdb6 是在第二个 SCSI 硬盘上的第二个逻辑分区。</p>
<p>因此，上边的sdc指的是系统中的第3块SCSI磁盘，sdc1指的是第3块SCSI磁盘上的第1个主分区或者扩展分区。</p>
</blockquote>
<h3 id="2-2-imx6mksdboot-sh脚本"><a href="#2-2-imx6mksdboot-sh脚本" class="headerlink" title="2.2 imx6mksdboot.sh脚本"></a><font size=3>2.2 imx6mksdboot.sh脚本</font></h3><p>这个脚本是正点原子提供的，里边就是一些命令，这里就不详细分析脚本了，里边其实挺简单的，只是把需要敲的命令放到了脚本，方便使用。大概就是将TF卡进行格式化，然后进行分区，再把u-boot、linux内核、设备树和根文件系统等写入到TF卡中去。我们可以执行 .&#x2F;imx6mksdboot.sh –help 查看脚本的使用方法：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">这里有可能我们没有脚本执行权限，执行下面的命令即可</span></span><br><span class="line">chmod +x imx6mksdboot.sh</span><br><span class="line">./imx6mksdboot.sh --help</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715113606940.png" alt="image-20230715113606940" style="zoom:50%;" />

<p>可以看到，基本的使用命令如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">imx6mksdboot.sh [选项] &lt;(必选)-device&gt; &lt;(可选)-flash&gt; &lt;(可选)-ddrsize&gt;</span><br></pre></td></tr></table></figure>

<p>（1） -device：指明设备节点（TF 卡挂载的节点如&#x2F;dev&#x2F;sdx）， 必需加这个参数</p>
<p>（2） -flash：指明核心板上的媒体存储介质，可选为（emmc或者nand）</p>
<p>（3） -ddrsize：指明核心板上的 ddr 容量大小，可选为（512或者256） MB</p>
<p>比如现在我现在用的是核心板的 ddr 容量大小是 512MB，媒体存储介质是 eMMC。 SD 卡挂载节点为&#x2F;dev&#x2F;sdc。那么烧写到 SD 卡的指令如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./imx6mksdboot.sh -device /dev/sdc -flash emmc -ddrsize 512</span><br></pre></td></tr></table></figure>

<p>执行指令后脚本会有中文再次询问 SD 卡所挂载的节点是否对应，将会清空 SD 卡上的所有数据，这个时候需要注意备份重要的数据。然后按 Enter 键确认后继续，烧写 SD 卡需要大约需要几分钟时间，这里根据个人电脑不同和所用 SD 卡不同，可能花费的时间差异比较大。  </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715114548282.png" alt="image-20230715114548282" style="zoom:50%;" />

<p>在烧写的过程中，会卸载 TF 卡，在脚本执行时，鼠标不要离开 Ubuntu 虚拟机，否则可能在脚本卸载 TF 卡时， TF 卡连接到 PC 主机上去了，这样脚本就无法找到 TF 卡执行，就会提示“mount: special device &#x2F;dev&#x2F;sdb1 does not exist”这样的错误。 烧写时有中英文结合提示烧写的过程，烧写完成如下图。  烧写完成后，会有如下提示信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715132327384.png" alt="image-20230715132327384" style="zoom:50%;" />

<h3 id="2-3-TF卡中都烧写了什么？"><a href="#2-3-TF卡中都烧写了什么？" class="headerlink" title="2.3 TF卡中都烧写了什么？"></a><font size=3>2.3 TF卡中都烧写了什么？</font></h3><p>烧写完成后，TF卡中都有什么文件？可以看吗？当然可以啦，我们搜索一下&#x2F;dev&#x2F;目录下sdc的相关节点：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls /dev/sd*</span><br></pre></td></tr></table></figure>

<p>可以看到有如下的节点：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715132943564.png" alt="image-20230715132943564" style="zoom:50%;" />

<p>发现有sdc、sdc1和sdc2这三个节点，从前边烧写过程中脚本的打印信息可以看出，sdc1中主要是放的设备树和内核，在sdc2中主要是文件系统，我们来挂载一下这两个分区，看一下里边的内容：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p ~/i.mx6ull/sdc1_temp</span><br><span class="line">mkdir -p ~/i.mx6ull/sdc2_temp</span><br><span class="line"></span><br><span class="line">sudo mount /dev/sdc1 ~/i.mx6ull/sdc1_temp</span><br><span class="line">sudo mount /dev/sdc2 ~/i.mx6ull/sdc2_temp</span><br></pre></td></tr></table></figure>

<p>这样就可以看到sdc1和sdc2分区中文件如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715133500709.png" alt="image-20230715133500709" style="zoom:50%;" />

<h3 id="2-4-断开TF卡"><a href="#2-4-断开TF卡" class="headerlink" title="2.4 断开TF卡"></a><font size=3>2.4 断开TF卡</font></h3><p>若是前边将tf卡的分区挂载到了ubuntu，可以用下边的命令卸载：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo umount ~/i.mx6ull/sdc1_temp</span><br><span class="line">sudo umount ~/i.mx6ull/sdc2_temp</span><br></pre></td></tr></table></figure>

<p>然后按连接 TF 卡到 Ubuntu 的方法，再点击断开即可退出 TF 卡。 </p>
<h3 id="2-5-重启测试"><a href="#2-5-重启测试" class="headerlink" title="2.5 重启测试"></a><font size=3>2.5 重启测试</font></h3><p>烧写完成后，将拨码开关拨至 TF 启动方式 10000010，启动系统即可。若是成功则可以正常进入linux系统：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715133925204.png" alt="image-20230715133925204" style="zoom:50%;" />

<h2 id="3-烧写到eMMC-1"><a href="#3-烧写到eMMC-1" class="headerlink" title="3. 烧写到eMMC"></a><font size=3>3. 烧写到eMMC</font></h2><p>脚本怎么烧写到eMMC？这个<strong>需要在开发板运行起来linux系统后</strong>才能用，这也就意味着我们需要有一个TF卡启动系统。来先在开发板上跑起来linux系统。换句话说，就是我们使用开发板上已经在运行的linux系统来操作eMMC，把相关的固件写到对应的地方去。</p>
<h3 id="3-1-准备TF启动系统"><a href="#3-1-准备TF启动系统" class="headerlink" title="3.1 准备TF启动系统"></a><font size=3>3.1 准备TF启动系统</font></h3><p>按照前边的 《一、mfgtool 烧写系统（OTG 方式）——2. 烧写系统到TF卡》或者《二、脚本烧写系统——2. 烧写系统到TF卡》先制作一个TF启动系统。</p>
<h3 id="3-2-在ubuntu下拷贝所需文件"><a href="#3-2-在ubuntu下拷贝所需文件" class="headerlink" title="3.2 在ubuntu下拷贝所需文件"></a><font size=3>3.2 在ubuntu下拷贝所需文件</font></h3><p>我们需要将下边目录中的文件拷贝到开发板的根文件系统（注意这一步是在虚拟机的ubuntu中进行，并不是在开发板的linux系统进行）：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">开发板光盘 A-基础资料/05、开发工具/04、正点原子MFG_TOOL 出厂固件烧录具/mfgtool/Profiles/Linux/OS Firmware/files</span><br></pre></td></tr></table></figure>

<p>怎么拷贝？目前就只能用TF卡启动系统喽（也就是说我们需要先做一个TF卡启动盘），前边我们知道TF卡的分区2中是放的linux的根文件系统，所以我们可以在ubuntu中挂载TF卡，然后将files目录拷贝到根文件系统中。</p>
<ul>
<li>挂载TF卡的根文件系统分区</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p ~/i.mx6ull/temp</span><br><span class="line">sudo mount /dev/sdc2 ~/i.mx6ull/temp</span><br></pre></td></tr></table></figure>

<p>挂载成功后，temp目录文件如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715161559248.png" alt="image-20230715161559248" style="zoom:50%;" />



<ul>
<li>拷贝files目录下所有的文件到根文件系统</li>
</ul>
<p>我们把files目录文件都拷贝到&#x2F;home目录下，在ubuntu中就在 ~&#x2F;i.mx6ull&#x2F;temp&#x2F;home 中了：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo cp -prf files ~/i.mx6ull/temp/home/</span><br></pre></td></tr></table></figure>

<p>拷贝完后， ~&#x2F;i.mx6ull&#x2F;temp&#x2F;home&#x2F;files 目录下文件如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715161837580.png" alt="image-20230715161837580" style="zoom:50%;" />

<ul>
<li>卸载tf卡</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo umount ~/i.mx6ull/temp</span><br></pre></td></tr></table></figure>

<h3 id="3-3-从TF卡启动开发板"><a href="#3-3-从TF卡启动开发板" class="headerlink" title="3.3 从TF卡启动开发板"></a><font size=3>3.3 从TF卡启动开发板</font></h3><p>接下来我们将拨码开关拨到 10000010 ，将刚才的TF卡插到开发板中，系统就会从TF卡启动了，启动完成后我们看一下files文件都在不在&#x2F;home中：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715162450581.png" alt="image-20230715162450581" style="zoom:50%;" />

<h3 id="3-4-imx6mkemmcboot-sh脚本"><a href="#3-4-imx6mkemmcboot-sh脚本" class="headerlink" title="3.4 imx6mkemmcboot.sh脚本"></a><font size=3>3.4 imx6mkemmcboot.sh脚本</font></h3><h4 id="3-4-1-脚本说明"><a href="#3-4-1-脚本说明" class="headerlink" title="3.4.1 脚本说明"></a><font size=3>3.4.1 脚本说明</font></h4><p>我们在串口终端执行.&#x2F;imx6mkemmcboot.sh –help 查看脚本的使用说明 ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chmod +x imx6mkemmcboot.sh</span><br><span class="line">./imx6mkemmcboot.sh --help</span><br></pre></td></tr></table></figure>

<p>可以看到如下提示信息：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715162650620.png" alt="image-20230715162650620" style="zoom: 50%;" />

<p>用法说明：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">imx6mkemmcboot.sh [选项] &lt;(必选)-device&gt; &lt;(可选)-ddrsize&gt;</span><br></pre></td></tr></table></figure>

<p>（1） -device：指明设备节点（eMMC 挂载的节点如&#x2F;dev&#x2F;mmcblk1）， 必需加这个参数</p>
<p>（2） -ddrsize：指明核心板上的 ddr 容量大小，可选为（512或者256） MB</p>
<p>比如现在我的核心板的 ddr 容量大小是 512MB ， eMMC 挂载节点为 &#x2F;dev&#x2F;mmcblk1 。那么烧写的指令如下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./imx6mkemmcboot.sh -device /dev/mmcblk1 -ddrsize 512</span><br></pre></td></tr></table></figure>

<p>执行指令后脚本会有中文再次询问 eMMC 所挂载的节点是否对应，将会清空 eMMC 上的所有数据，这个时候要注意备份重要的数据。按 Enter 键确认后继续，烧写系统到 eMMC 需要大约需要几分钟时间。  </p>
<h4 id="3-4-2-查看eMMC挂载节点"><a href="#3-4-2-查看eMMC挂载节点" class="headerlink" title="3.4.2 查看eMMC挂载节点"></a><font size=3>3.4.2 查看eMMC挂载节点</font></h4><p>我们需要查看一下eMMC的挂载节点，我们在串口终端执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fdisk -l</span><br></pre></td></tr></table></figure>

<p>可以看到有如下信息输出：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715163114529.png" alt="image-20230715163114529" style="zoom:50%;" />

<p>可以看到挂载的节点为 &#x2F;dev&#x2F;mmcblk1，后边的p1和p2就是分区，跟前边的sdc1和sdc2一样。</p>
<h4 id="3-4-3-烧写系统"><a href="#3-4-3-烧写系统" class="headerlink" title="3.4.3 烧写系统"></a><font size=3>3.4.3 烧写系统</font></h4><p>前面我们知道核心板的 ddr 容量大小是 512MB ， eMMC 挂载节点为&#x2F;dev&#x2F;mmcblk1。那么烧写的指令如下，执行指令后脚本会有中文<br>再次询问 eMMC 所挂载的节点是否对应，将会清空 eMMC 上的所有数据，要注意备份重要的数据。</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./imx6mkemmcboot.sh -device /dev/mmcblk1 -ddrsize 512</span><br></pre></td></tr></table></figure>

<p>然后会有以下提示，需要我们按下Enter按键：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715163349191.png" alt="image-20230715163349191" style="zoom:50%;" />

<p>之后便会开始将files中相关的文件写入到eMMC中去，写入完成后有如下提示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164046712.png" alt="image-20230715164046712" style="zoom:50%;" />

<p>从这里大概可以知道，我们将内核和设备树都写入到了 &#x2F;dev&#x2F;mmcblk1p1 中，将根文件系统和模块都写入到了 &#x2F;dev&#x2F;mmcblk1p2 中。</p>
<h3 id="3-5-eMMC中都烧写了什么？"><a href="#3-5-eMMC中都烧写了什么？" class="headerlink" title="3.5 eMMC中都烧写了什么？"></a><font size=3>3.5 eMMC中都烧写了什么？</font></h3><p>跟之前的方法一样，想要看eMMC分区中都有什么，我们需要挂载分区才行，我们先看一下eMMC的分区节点：，在串口终端执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ls /dev/mmc*</span><br></pre></td></tr></table></figure>

<p>然后会看到有如下节点：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164340236.png" alt="image-20230715164340236" style="zoom:50%;" />

<p>从刚才烧写完成的提示信息中可以看到我们实际用到的是mmcblk1的p1和p2分区，我们挂载这两个分区，看一下都有什么内容：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p /home/emmc_p1 /home/emmc_p2</span><br><span class="line">mount /dev/mmcblk1p1 /home/emmc_p1</span><br><span class="line">mount /dev/mmcblk1p2 /home/emmc_p2</span><br></pre></td></tr></table></figure>

<p>一般应该没啥大问题，都可以挂载成功，我们看一下都有那些文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715164749796.png" alt="image-20230715164749796" style="zoom:50%;" />

<p>可以看到与上边的打印信息是吻合的。</p>
<h3 id="3-6-重启测试"><a href="#3-6-重启测试" class="headerlink" title="3.6 重启测试"></a><font size=3>3.6 重启测试</font></h3><p>烧写完成后，我们可以将拨码开关拨至 eMMC 启动方式 10100110，启动系统即可。 若是烧写成功，则可以正常进入linux系统：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20230715165016888.png" alt="image-20230715165016888" style="zoom:50%;" />

<h2 id="6-烧写到NAND"><a href="#6-烧写到NAND" class="headerlink" title="6. 烧写到NAND"></a><font size=3>6. 烧写到NAND</font></h2><h3 id="6-1-准备TF启动系统"><a href="#6-1-准备TF启动系统" class="headerlink" title="6.1 准备TF启动系统"></a><font size=3>6.1 准备TF启动系统</font></h3><p>按照前边的 《一、mfgtool 烧写系统（OTG 方式）——2. 烧写系统到TF卡》或者《二、脚本烧写系统——2. 烧写系统到TF卡》先制作一个TF启动系统。</p>
<h3 id="6-2-MTD-分区表"><a href="#6-2-MTD-分区表" class="headerlink" title="6.2 MTD 分区表  "></a><font size=3>6.2 MTD 分区表  </font></h3><p>在开发板linux系统中使用 cat 指令查看 MTD 分区表，打印结果如下图表示存在 Nand Flash。  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /proc/mtd</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072256965.png" alt="image-20240402072256965" style="zoom:75%;" />

<h3 id="6-3-imx6mknandboot-sh-脚本"><a href="#6-3-imx6mknandboot-sh-脚本" class="headerlink" title="6.3 imx6mknandboot.sh 脚本"></a><font size=3>6.3 imx6mknandboot.sh 脚本</font></h3><ul>
<li>赋予 NandFlash 烧写脚本的可执行权限</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chmod +x imx6mknandboot.sh</span><br></pre></td></tr></table></figure>

<ul>
<li>查看脚本的使用说明</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./imx6mknandboot.sh --help</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072427363.png" alt="image-20240402072427363" style="zoom:72%;" />

<ul>
<li>用法说明</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">imx6mknandboot.sh [选项] &lt;(可选)-ddrsize&gt;</span><br></pre></td></tr></table></figure>

<p>-ddrsize：指明核心板上的 ddr 容量大小，可选为（512|256） MB  </p>
<ul>
<li>烧写指令</li>
</ul>
<p>若我们使用核心板的 ddr 容量大小是 256MB，那么烧写的指令如下。这将会清空 NandFlash 上的所有数据，请注意备份重要的数据。按 Enter 键确认后继续，烧写系统到 NandFlash 需要大约需要几分钟时间。  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./imx6mknandboot.sh -ddrsize 256</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072633479.png" alt="image-20240402072633479" style="zoom:55%;" />

<p>烧写完成如下图所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-03-%E5%BC%80%E5%8F%91%E6%9D%BF%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99/img/image-20240402072801579.png" alt="image-20240402072801579" style="zoom:53%;" />

<h3 id="6-4-重启测试"><a href="#6-4-重启测试" class="headerlink" title="6.4 重启测试"></a><font size=3>6.4 重启测试</font></h3><p>烧写完成后，将拨码开关拨至 Nand Flash 启动方式 10001001，启动系统即可。  </p>
<h2 id="4-shell脚本分析"><a href="#4-shell脚本分析" class="headerlink" title="4. shell脚本分析"></a><font size=3>4. shell脚本分析</font></h2><h3 id="4-1-imx6mksdboot-sh"><a href="#4-1-imx6mksdboot-sh" class="headerlink" title="4.1 imx6mksdboot.sh"></a><font size=3>4.1 imx6mksdboot.sh</font></h3><details class="folding-tag" blue><summary> 点击查看 imx6mksdboot.sh </summary>
              <div class='content'>
              <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">! /bin/sh</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">I.MX6 SD卡启动系统烧写脚本</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Author QQ1252699831</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">company 广州星翼电子科技有限公司</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.0 2019.10.26</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1 2020.11.7 1.添加判断文件系统是否存在/lib/modules目录的功能，再解压模块</span></span><br><span class="line">VERSION=&quot;1.1&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">打印用法</span></span><br><span class="line">usage ()</span><br><span class="line">&#123;</span><br><span class="line">  echo &quot;</span><br><span class="line"></span><br><span class="line">用法: `basename $1` [选项] &lt;(必选)-device&gt; &lt;(可选)-flash&gt; &lt;(可选)-ddrsize&gt;</span><br><span class="line">用法示例：</span><br><span class="line">sudo ./imx6mksdboot.sh -device /dev/sdd</span><br><span class="line">sudo ./imx6mksdboot.sh -device /dev/sdd -flash emmc -ddrsize 512 </span><br><span class="line">命令选项:</span><br><span class="line">  -device              SD卡块设备节点 (例如/dev/sdx)</span><br><span class="line">  -flash	       请选择开发板Flash类型（emmc | nand）</span><br><span class="line">  -ddrsize	       请选择DDR大小 （512 | 256） </span><br><span class="line">可选选项:</span><br><span class="line">  --version             打印版本信息.</span><br><span class="line">  --help                打印帮助信息.</span><br><span class="line">&quot;</span><br><span class="line">  exit 1</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Uboot默认值</span></span><br><span class="line">Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">execute执行语句成功与否打印</span></span><br><span class="line">execute ()</span><br><span class="line">&#123;</span><br><span class="line">    $* &gt;/dev/null</span><br><span class="line">    if [ $? -ne 0 ]; then</span><br><span class="line">        echo</span><br><span class="line">        echo &quot;错误: 执行 $*&quot;</span><br><span class="line">        echo</span><br><span class="line">        exit 1</span><br><span class="line">    fi</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">打印版本信息</span></span><br><span class="line">version ()</span><br><span class="line">&#123;</span><br><span class="line">  echo</span><br><span class="line">  echo &quot;`basename $1` version $VERSION&quot;</span><br><span class="line">  echo &quot;I.MX6 SD卡制卡脚本&quot;</span><br><span class="line">  echo</span><br><span class="line"></span><br><span class="line">  exit 0</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断参数个数</span></span><br><span class="line">arg=$#</span><br><span class="line">if [ $arg -ne 6 ];then</span><br><span class="line">number=1</span><br><span class="line"></span><br><span class="line">while [ $# -gt 0 ]; do</span><br><span class="line">  case $1 in</span><br><span class="line">    --help | -h)</span><br><span class="line">      usage $0</span><br><span class="line">      ;;</span><br><span class="line">    -device) shift; device=$1; shift; ;;</span><br><span class="line">    --version) version $0;;</span><br><span class="line">    *) copy=&quot;$copy $1&quot;; shift; ;;</span><br><span class="line">  esac</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断字符串是否为零</span></span><br><span class="line">test -z $device &amp;&amp; usage $0</span><br><span class="line">echo &quot;&quot;</span><br><span class="line">echo &quot;根据下面的提示，补全缺省的参数-flash -ddrsize&quot;</span><br><span class="line">read -p &quot;请选择开发板参数，输入数字1~4，按Enter键确认</span><br><span class="line">1.-flash emmc，-ddrsize 512</span><br><span class="line">2.-flash emmc，-ddrsize 256</span><br><span class="line">3.-flash nand，-ddrsize 512</span><br><span class="line">4.-flash nand，-ddrsize 256 </span><br><span class="line">输入数字1~4(default 1): &quot; number</span><br><span class="line">if [ -z $number ];then</span><br><span class="line">  echo &quot;使用默认参数:EMMC版本，DDR大小为512MB&quot;</span><br><span class="line">else</span><br><span class="line">  case $number in</span><br><span class="line">    1)  echo &#x27;您已经选择开发板参数为：EMMC版本，DDR大小为512MB&#x27;</span><br><span class="line">	Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    2)  echo &#x27;您已经选择开发板参数为：EMMC版本，DDR大小为256MB&#x27;</span><br><span class="line">	Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-emmc.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    3)  echo &#x27;您已经选择开发板参数为：NAND FLASH版本，DDR大小为512MB&#x27;</span><br><span class="line">	Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-nand-sd.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    4)  echo &#x27;您已经选择开发板参数为：NAND FLASH版本，DDR大小为256MB&#x27;</span><br><span class="line">	Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-nand-sd.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    *)  echo &#x27;输入的参数有误，退出制卡&#x27;;exit;</span><br><span class="line">    ;;</span><br><span class="line">esac</span><br><span class="line">fi</span><br><span class="line">else</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">命令行处理，根据选项获得参数</span></span><br><span class="line">while [ $# -gt 0 ]; do</span><br><span class="line">  case $1 in</span><br><span class="line">    --help | -h)</span><br><span class="line">      usage $0</span><br><span class="line">      ;;</span><br><span class="line">    -device) shift; device=$1; shift; ;;</span><br><span class="line">    -flash) shift; flash=$1; shift; ;;</span><br><span class="line">    -ddrsize) shift; ddrsize=$1; shift; ;;</span><br><span class="line">    --version) version $0;;</span><br><span class="line">    *) copy=&quot;$copy $1&quot;; shift; ;;</span><br><span class="line">  esac</span><br><span class="line">done</span><br><span class="line">  if [ $flash = &quot;emmc&quot; -a $ddrsize = &quot;512&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：EMMC版本，DDR大小为512MB&#x27;</span><br><span class="line"></span><br><span class="line">  elif [ $flash = &quot;emmc&quot; -a $ddrsize = &quot;256&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-emmc.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：EMMC版本，DDR大小为256MB&#x27;</span><br><span class="line"></span><br><span class="line">  elif [ $flash = &quot;nand&quot; -a $ddrsize = &quot;512&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-nand-sd.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：NAND FLASH版本，DDR大小为512MB&#x27;</span><br><span class="line"></span><br><span class="line">  elif [ $flash = &quot;nand&quot; -a $ddrsize = &quot;256&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-nand-sd.imx&#x27;</span><br><span class="line">    echo &#x27;您的开发板参数为：NAND FLASH版本，DDR大小为256MB&#x27;</span><br><span class="line">  else</span><br><span class="line">    echo &#x27;参数有误!&#x27;</span><br><span class="line">    usage $0</span><br><span class="line">  fi </span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">测试制卡包当前目录下是否缺失制卡所需要的文件</span></span><br><span class="line">sdkdir=$PWD</span><br><span class="line"></span><br><span class="line">if [ ! -d $sdkdir ]; then</span><br><span class="line">   echo &quot;错误: $sdkdir目录不存在&quot;</span><br><span class="line">   exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/filesystem/*.tar.* ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/filesystem/下找不到文件系统压缩包&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/boot/zImage ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/boot/下找不到zImage&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断选择的块设备是否存在及是否是一个块设备</span></span><br><span class="line">if [ ! -b $device ]; then</span><br><span class="line">  echo &quot;错误: $device 不是一个块设备文件&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">这里防止选错设备，否则会影响Ubuntu系统的启动</span></span><br><span class="line">if [ $device = &#x27;/dev/sda&#x27; ];then</span><br><span class="line">  echo &quot;请不要选择sda设备，/dev/sda通常是您的Ubuntu硬盘!</span><br><span class="line">继续操作你的系统将会受到影响！脚本已自动退出&quot;</span><br><span class="line">  exit 1 </span><br><span class="line">fi</span><br><span class="line">echo &quot;即将进行制作SD系统启动卡，大约花费几分钟时间,请耐心等待!&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">echo &quot;*         注意：这将会清除$device所有的数据               *&quot;</span><br><span class="line">echo &quot;*         在脚本执行时请不要将$device拔出                 *&quot;</span><br><span class="line">echo &quot;*             请按&lt;Enter&gt;确认继续                          *&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">read enter</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">格式化前要卸载</span></span><br><span class="line">for i in `ls -1 $device?`; do</span><br><span class="line"> echo &quot;卸载 device &#x27;$i&#x27;&quot;</span><br><span class="line"> umount $i 2&gt;/dev/null</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">执行格式化<span class="variable">$device</span></span></span><br><span class="line">execute &quot;dd if=/dev/zero of=$device bs=1024 count=1024&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第一个分区为64M用来存放设备树与内核镜像文件，因为设备树与内核都比较小，不需要太大的空间</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第二个分区为SD卡的总大小-64M，用来存放文件系统</span></span><br><span class="line">cat &lt;&lt; END | fdisk -H 255 -S 63 $device</span><br><span class="line">n</span><br><span class="line">p</span><br><span class="line">1</span><br><span class="line"></span><br><span class="line">+64M</span><br><span class="line">n</span><br><span class="line">p</span><br><span class="line">2</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">t</span><br><span class="line">1</span><br><span class="line">c</span><br><span class="line">a</span><br><span class="line">1</span><br><span class="line">w</span><br><span class="line">END</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">两个分区处理</span></span><br><span class="line">PARTITION1=$&#123;device&#125;1</span><br><span class="line">if [ ! -b $&#123;PARTITION1&#125; ]; then</span><br><span class="line">        PARTITION1=$&#123;device&#125;1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">PARTITION2=$&#123;device&#125;2</span><br><span class="line">if [ ! -b $&#123;PARTITION2&#125; ]; then</span><br><span class="line">        PARTITION2=$&#123;device&#125;2</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第一个分区创建为Fat32格式</span></span><br><span class="line">echo &quot;格式化 $&#123;device&#125;1 ...&quot;</span><br><span class="line">if [ -b $&#123;PARTITION1&#125; ]; then</span><br><span class="line">	mkfs.vfat -F 32 -n &quot;boot&quot; $&#123;PARTITION1&#125;</span><br><span class="line">else</span><br><span class="line">	echo &quot;错误: /dev下找不到 SD卡 boot分区&quot;</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第二个分区创建为ext3格式</span></span><br><span class="line">echo &quot;格式化$&#123;device&#125;2 ...&quot;</span><br><span class="line">if [ -b $&#123;PARITION2&#125; ]; then</span><br><span class="line">	mkfs.ext3 -F -L &quot;rootfs&quot; $&#123;PARTITION2&#125;</span><br><span class="line">else</span><br><span class="line">	echo &quot;错误: /dev下找不到 SD卡 rootfs分区&quot;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">while [ ! -e $device ]</span><br><span class="line">do</span><br><span class="line">sleep 1</span><br><span class="line">echo &quot;wait for $device appear&quot;</span><br><span class="line">done</span><br><span class="line"></span><br><span class="line">echo &quot;正在烧写$&#123;Uboot&#125;到$&#123;device&#125;&quot;</span><br><span class="line">execute &quot;dd if=$sdkdir/boot/$Uboot of=$device bs=1024 seek=1 conv=fsync&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;烧写$&#123;Uboot&#125;到$&#123;device&#125;完成！&quot;</span><br><span class="line"></span><br><span class="line">echo &quot;正在准备复制...&quot;</span><br><span class="line">echo &quot;正在复制设备树与内核到$&#123;device&#125;1，请稍候...&quot;</span><br><span class="line">execute &quot;mkdir -p /tmp/sdk/$$&quot;</span><br><span class="line"></span><br><span class="line">while [ ! -e $&#123;device&#125;1 ]</span><br><span class="line">do</span><br><span class="line">sleep 1</span><br><span class="line">echo &quot;wait for $&#123;device&#125;1 appear&quot;</span><br><span class="line">done</span><br><span class="line"></span><br><span class="line">execute &quot;mount $&#123;device&#125;1 /tmp/sdk/$$&quot;</span><br><span class="line">execute &quot;cp -r $sdkdir/boot/*$&#123;flash&#125;*.dtb /tmp/sdk/$$/&quot;</span><br><span class="line">execute &quot;cp -r $sdkdir/boot/zImage /tmp/sdk/$$/&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">execute <span class="string">&quot;cp <span class="variable">$sdkdir</span>/boot/alientek.bmp /tmp/sdk/$$/&quot;</span></span></span><br><span class="line">sync</span><br><span class="line">echo &quot;复制设备树与内核到$&#123;device&#125;1完成！&quot;</span><br><span class="line"></span><br><span class="line">if [ &quot;$copy&quot; != &quot;&quot; ]; then</span><br><span class="line">  echo &quot;Copying additional file(s) on $&#123;device&#125;p1&quot;</span><br><span class="line">  execute &quot;cp -r $copy /tmp/sdk/$$&quot;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;卸载$&#123;device&#125;1&quot;</span><br><span class="line">execute &quot;umount /tmp/sdk/$$&quot;</span><br><span class="line">sleep 1</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">解压文件系统到文件系统分区</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">挂载文件系统分区</span></span><br><span class="line">execute &quot;mkdir -p /tmp/sdk/$$&quot;</span><br><span class="line">execute &quot;mount $&#123;device&#125;2 /tmp/sdk/$$&quot;</span><br><span class="line"></span><br><span class="line">echo &quot;正在解压文件系统到$&#123;device&#125;2 ，请稍候...&quot;</span><br><span class="line">rootfs=`ls -1 filesystem/*.tar.*`</span><br><span class="line">execute &quot;tar jxfm $rootfs -C /tmp/sdk/$$&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;解压文件系统到$&#123;device&#125;2完成！&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断是否存在这个目录，如果不存在就为文件系统创建一个modules目录</span></span><br><span class="line">if [ ! -e &quot;/tmp/sdk//lib/modules/&quot; ];then</span><br><span class="line">mkdir -p /tmp/sdk/lib/modules/</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;正在解压模块到$&#123;device&#125;2/lib/modules/ ，请稍候...&quot;</span><br><span class="line">modules=`ls -1 modules/*.tar.*`</span><br><span class="line">execute &quot;tar jxfm $modules -C /tmp/sdk/$$/lib/modules/&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;解压模块到$&#123;device&#125;2/lib/modules/完成！&quot;</span><br><span class="line"></span><br><span class="line">echo &quot;卸载$&#123;device&#125;2&quot;</span><br><span class="line">execute &quot;umount /tmp/sdk/$$&quot;</span><br><span class="line"></span><br><span class="line">execute &quot;rm -rf /tmp/sdk/$$&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;SD卡启动系统烧写完成！&quot;</span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="4-2-imx6mkemmcboot-sh"><a href="#4-2-imx6mkemmcboot-sh" class="headerlink" title="4.2 imx6mkemmcboot.sh"></a><font size=3>4.2 imx6mkemmcboot.sh</font></h3><details class="folding-tag" blue><summary> 点击查看imx6mkemmcboot.sh </summary>
              <div class='content'>
              <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/sh</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">I.MX6 eMMC启动系统烧写脚本</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Author QQ1252699831</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">company 广州星翼电子科技有限公司</span></span><br><span class="line">VERSION=&quot;1.1&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.0 2019.10.26</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1 2020.11.7 1.添加判断文件系统是否存在/lib/modules目录的功能，再解压模块</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">打印用法</span></span><br><span class="line">usage ()</span><br><span class="line">&#123;</span><br><span class="line">  echo &quot;</span><br><span class="line"></span><br><span class="line">用法: `basename $1` [选项] &lt;(必选)-device&gt; &lt;(可选)-ddrsize&gt;</span><br><span class="line">用法示例：</span><br><span class="line">./imx6mkemmcboot.sh -device /dev/mmcblk1</span><br><span class="line">./imx6mkemmcboot.sh -device /dev/mmcblk1 -ddrsize 512</span><br><span class="line">命令选项:</span><br><span class="line">  -device              eMMC块设备节点 (一般eMMC设备节点为/dev/mmcblk1)</span><br><span class="line">  -ddrsize             请选择DDR大小 （512 | 256)</span><br><span class="line">可选选项:</span><br><span class="line">  --version             打印版本信息.</span><br><span class="line">  --help                打印帮助信息.</span><br><span class="line">&quot;</span><br><span class="line">  exit 1</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Uboot默认值</span></span><br><span class="line">Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">execute执行语句成功与否打印</span></span><br><span class="line">execute ()</span><br><span class="line">&#123;</span><br><span class="line">    $* &gt;/dev/null</span><br><span class="line">    if [ $? -ne 0 ]; then</span><br><span class="line">        echo</span><br><span class="line">        echo &quot;错误: 执行 $*&quot;</span><br><span class="line">        echo</span><br><span class="line">        exit 1</span><br><span class="line">    fi</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">打印版本信息</span></span><br><span class="line">version ()</span><br><span class="line">&#123;</span><br><span class="line">  echo</span><br><span class="line">  echo &quot;`basename $1` version $VERSION&quot;</span><br><span class="line">  echo &quot;I.MX6 系统烧写脚本&quot;</span><br><span class="line">  echo</span><br><span class="line"></span><br><span class="line">  exit 0</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">等待mmc</span></span><br><span class="line">while [ ! -e /dev/mmcblk1 ];do </span><br><span class="line">sleep 1</span><br><span class="line">echo \&quot;等待mmcblk1...\&quot;</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断参数个数</span></span><br><span class="line">arg=$#</span><br><span class="line">if [ $arg -ne 4 ];then</span><br><span class="line">number=1</span><br><span class="line">while [ $# -gt 0 ]; do</span><br><span class="line">  case $1 in</span><br><span class="line">    --help | -h)</span><br><span class="line">      usage $0</span><br><span class="line">      ;;</span><br><span class="line">    -device) shift; device=$1; shift; ;;</span><br><span class="line">    --version) version $0;;</span><br><span class="line">    *) copy=&quot;$copy $1&quot;; shift; ;;</span><br><span class="line">  esac</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断字符串是否为零</span></span><br><span class="line">test -z $device &amp;&amp; usage $0</span><br><span class="line">echo &quot;&quot;</span><br><span class="line">echo &quot;根据下面的提示，补全缺省的参数-ddrsize&quot;</span><br><span class="line">read -p &quot;请选择开发板参数，输入数字1|2，按Enter键确认</span><br><span class="line">1.-ddrsize 512</span><br><span class="line">2.-ddrsize 256</span><br><span class="line">输入数字1~4(default 1): &quot; number</span><br><span class="line">if [ -z $number ];then</span><br><span class="line">  echo &quot;使用默开发板参数DDR大小为512MB&quot;</span><br><span class="line">else</span><br><span class="line">  case $number in</span><br><span class="line">    1)  echo &#x27;您已经选择开发板参数为：DDR大小为512MB&#x27;</span><br><span class="line">        Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    2)  echo &#x27;您已经选择开发板参数为：DDR大小为256MB&#x27;</span><br><span class="line">        Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-emmc.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    *)  echo &#x27;输入的参数有误，退出烧写eMMC&#x27;;exit;</span><br><span class="line">    ;;</span><br><span class="line">esac</span><br><span class="line">fi</span><br><span class="line">else</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">命令行处理，根据选项获得参数</span></span><br><span class="line">while [ $# -gt 0 ]; do</span><br><span class="line">  case $1 in</span><br><span class="line">    --help | -h)</span><br><span class="line">      usage $0</span><br><span class="line">      ;;</span><br><span class="line">    -device) shift; device=$1; shift; ;;</span><br><span class="line">    -ddrsize) shift; ddrsize=$1; shift; ;;</span><br><span class="line">    --version) version $0;;</span><br><span class="line">    *) copy=&quot;$copy $1&quot;; shift; ;;</span><br><span class="line">  esac</span><br><span class="line">done</span><br><span class="line">  if [ $ddrsize = &quot;512&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-emmc.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：DDR大小为512MB&#x27;</span><br><span class="line">  elif [ $ddrsize = &quot;256&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-emmc.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：DDR大小为256MB&#x27;</span><br><span class="line">  else</span><br><span class="line">    echo &#x27;参数有误!&#x27;</span><br><span class="line">    usage $0</span><br><span class="line">  fi</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">测试制卡包当前目录下是否缺失制卡所需要的文件</span></span><br><span class="line">sdkdir=$PWD</span><br><span class="line"></span><br><span class="line">if [ ! -d $sdkdir ]; then</span><br><span class="line">   echo &quot;错误: $sdkdir目录不存在&quot;</span><br><span class="line">   exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/filesystem/*.tar.* ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/filesystem/下找不到文件系统压缩包&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/boot/zImage ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/boot/下找不到zImage&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -b $device ]; then</span><br><span class="line">   echo &quot;错误: $device 不是一个块设备文件&quot;</span><br><span class="line">   exit 1</span><br><span class="line">fi</span><br><span class="line">echo &quot;即将进行制作eMMC系统启动卡，大约花费几分钟时间,请耐心等待!&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">echo &quot;*         注意：这将会清除$device所有的数据           *&quot;</span><br><span class="line">echo &quot;          烧写eMMC前，请备份好重要的数据                   *&quot;</span><br><span class="line">echo &quot;*             请按&lt;Enter&gt;确认继续                          *&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">read enter</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">分区前要卸载</span></span><br><span class="line">for i in `ls -1 $&#123;device&#125;p?`; do</span><br><span class="line"> echo &quot;卸载 device &#x27;$i&#x27;&quot;</span><br><span class="line"> umount $i 2&gt;/dev/null</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">清空<span class="variable">$device</span></span></span><br><span class="line">execute &quot;dd if=/dev/zero of=$device bs=1024 count=1024&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第一个分区为32M用来存放设备树与内核镜像文件，因为设备树与内核都比较小，不需要太大的空间</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第二个分区为eMMC的总大小-32M，用来存放文件系统</span></span><br><span class="line">cat &lt;&lt; END | fdisk -H 255 -S 63 $device</span><br><span class="line">n</span><br><span class="line">p</span><br><span class="line">1</span><br><span class="line"></span><br><span class="line">+32M</span><br><span class="line">n</span><br><span class="line">p</span><br><span class="line">2</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">t</span><br><span class="line">1</span><br><span class="line">c</span><br><span class="line">a</span><br><span class="line">1</span><br><span class="line">w</span><br><span class="line">END</span><br><span class="line">sleep 3</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">上面分区后系统会自动挂载，所以这里再一次卸载</span></span><br><span class="line">for i in `ls -1 $&#123;device&#125;p?`; do</span><br><span class="line"> echo &quot;卸载 device &#x27;$i&#x27;&quot;</span><br><span class="line"> umount $i 2&gt;/dev/null</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">两个分区处理</span></span><br><span class="line">PARTITION1=$&#123;device&#125;1</span><br><span class="line">if [ ! -b $&#123;PARTITION1&#125; ]; then</span><br><span class="line">        PARTITION1=$&#123;device&#125;p1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">PARTITION2=$&#123;device&#125;2</span><br><span class="line">if [ ! -b $&#123;PARTITION2&#125; ]; then</span><br><span class="line">        PARTITION2=$&#123;device&#125;p2</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第一个分区创建为Fat32格式</span></span><br><span class="line">echo &quot;Formating $&#123;device&#125;p1 ...&quot;</span><br><span class="line">if [ -b $&#123;PARTITION1&#125; ]; then</span><br><span class="line">	mkfs.vfat -F 32 -n &quot;boot&quot; $&#123;PARTITION1&#125;</span><br><span class="line">else</span><br><span class="line">	echo &quot;错误: /dev下找不到 eMMC boot分区&quot;</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">第二个分区创建为ext3格式</span></span><br><span class="line">echo &quot;格式化$&#123;device&#125;p2 ...&quot;</span><br><span class="line">if [ -b $&#123;PARITION2&#125; ]; then</span><br><span class="line">	mkfs.ext3 -F -L &quot;rootfs&quot; $&#123;PARTITION2&#125;</span><br><span class="line">else</span><br><span class="line">	echo &quot;错误: /dev下找不到 eMMC rootfs分区&quot;</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">烧写u-boot.imx到emmc boot0分区</span></span><br><span class="line">echo &quot;正在烧写$&#123;Uboot&#125;到$device&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">烧写前，先使能mmcblk1boot0</span></span><br><span class="line">echo 0 &gt; /sys/block/mmcblk1boot0/force_ro</span><br><span class="line">execute &quot;dd if=$sdkdir/boot/$Uboot of=$&#123;device&#125;boot0 bs=1024 seek=1 conv=fsync&quot;</span><br><span class="line">execute &quot;dd if=$sdkdir/boot/$Uboot of=$&#123;device&#125;boot0 bs=1024 seek=500 conv=fsync&quot;</span><br><span class="line">echo 1 &gt;/sys/block/mmcblk1boot0/force_ro</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">烧写内核与设备树到 emmc mmcblk1p1</span></span><br><span class="line">echo &quot;正在准备复制...&quot;</span><br><span class="line">echo &quot;正在复制设备树与内核到$&#123;device&#125;p1，请稍候...&quot;</span><br><span class="line">execute &quot;mkdir -p /tmp/sdk/$$&quot;</span><br><span class="line">execute &quot;mount $&#123;device&#125;p1 /tmp/sdk/$$&quot;</span><br><span class="line">execute &quot;cp -r $sdkdir/boot/*emmc*.dtb /tmp/sdk/$$/&quot;</span><br><span class="line">execute &quot;cp -r $sdkdir/boot/zImage /tmp/sdk/$$/&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;复制设备树与内核到$&#123;device&#125;p1完成！&quot;</span><br><span class="line"></span><br><span class="line">if [ &quot;$copy&quot; != &quot;&quot; ]; then</span><br><span class="line">  echo &quot;Copying additional file(s) on $&#123;device&#125;p1&quot;</span><br><span class="line">  execute &quot;cp -r $copy /tmp/sdk/$$&quot;</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;卸载$&#123;device&#125;p1&quot;</span><br><span class="line">execute &quot;umount /tmp/sdk/$$&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">挂载文件系统分区</span></span><br><span class="line">execute &quot;mkdir -p /tmp/sdk/$$&quot;</span><br><span class="line">execute &quot;mount $&#123;device&#125;p2 /tmp/sdk/$$&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">解压文件系统到 emmc mmcblk1p2</span></span><br><span class="line">echo &quot;正在解压文件系统到$&#123;device&#125;p2 ，请稍候...&quot;</span><br><span class="line">rootfs=`ls -1 filesystem/*.tar.*`</span><br><span class="line">execute &quot;tar jxfm $rootfs -C /tmp/sdk/$$&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;解压文件系统到$&#123;device&#125;p2完成！&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断是否存在这个目录，如果不存在就为文件系统创建一个modules目录</span></span><br><span class="line">if [ ! -e &quot;/tmp/sdk/$$/lib/modules/&quot; ];then</span><br><span class="line">mkdir -p /tmp/sdk/$$/lib/modules</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;正在解压模块到$&#123;device&#125;p2/lib/modules/，请稍候...&quot;</span><br><span class="line">modules=`ls -1 modules/*.tar.*`</span><br><span class="line">execute &quot;tar jxfm $modules -C /tmp/sdk/$$/lib/modules/&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;解压模块到$&#123;device&#125;p2/lib/modules/完成！&quot;</span><br><span class="line"></span><br><span class="line">echo &quot;卸载$&#123;device&#125;p2&quot;</span><br><span class="line">execute &quot;umount /tmp/sdk/$$&quot;</span><br><span class="line"></span><br><span class="line">execute &quot;rm -rf /tmp/sdk/$$&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">使能启动分区</span></span><br><span class="line">execute &quot;mmc bootpart enable 1 1 /dev/mmcblk1&quot;</span><br><span class="line">sync</span><br><span class="line">echo &quot;eMMC启动系统烧写完成！&quot;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h3 id="4-3-imx6mknandboot-sh"><a href="#4-3-imx6mknandboot-sh" class="headerlink" title="4.3 imx6mknandboot.sh"></a><font size=3>4.3 imx6mknandboot.sh</font></h3><details class="folding-tag" blue><summary> 点击查看imx6mknandboot.sh </summary>
              <div class='content'>
              <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">! /bin/sh</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">I.MX6 NandFlash启动系统烧写脚本</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Author QQ1252699831</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">company 广州星翼电子科技有限公司</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.0 2019.10.26</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">version v1.1 2020.11.7 1.添加判断文件系统是否存在/lib/modules目录的功能，再解压模块</span></span><br><span class="line"></span><br><span class="line">VERSION=&quot;1.0&quot;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">打印用法</span></span><br><span class="line">usage ()</span><br><span class="line">&#123;</span><br><span class="line">  echo &quot;</span><br><span class="line"></span><br><span class="line">用法: `basename $1` [选项] &lt;(可选)-ddrsize&gt;</span><br><span class="line">用法示例：</span><br><span class="line">./imx6mknandboot.sh</span><br><span class="line">./imx6mknandboot.sh -ddrsize 512</span><br><span class="line">命令选项:</span><br><span class="line">  -ddrsize             请选择DDR大小 （512 | 256)</span><br><span class="line">可选选项:</span><br><span class="line">  --version             打印版本信息.</span><br><span class="line">  --help                打印帮助信息.</span><br><span class="line">&quot;</span><br><span class="line">  exit 1</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">Uboot默认值</span></span><br><span class="line">Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-nand.imx&#x27;</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">execute执行语句成功与否打印</span></span><br><span class="line">execute ()</span><br><span class="line">&#123;</span><br><span class="line">    $* &gt;/dev/null</span><br><span class="line">    if [ $? -ne 0 ]; then</span><br><span class="line">        echo</span><br><span class="line">        echo &quot;错误: 执行 $*&quot;</span><br><span class="line">        echo</span><br><span class="line">        exit 1</span><br><span class="line">    fi</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">version ()</span><br><span class="line">&#123;</span><br><span class="line">  echo</span><br><span class="line">  echo &quot;`basename $1` version $VERSION&quot;</span><br><span class="line">  echo &quot;I.MX6 NandFlash启动系统烧写脚本&quot;</span><br><span class="line">  echo</span><br><span class="line"></span><br><span class="line">  exit 0</span><br><span class="line">&#125;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断参数个数</span></span><br><span class="line">arg=$#</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">命令行处理，根据选项获得参数</span></span><br><span class="line">while [ $# -gt 0 ]; do</span><br><span class="line">  case $1 in</span><br><span class="line">    --help | -h)</span><br><span class="line">      usage $0</span><br><span class="line">      ;;</span><br><span class="line">    -ddrsize) shift; ddrsize=$1;shift; ;;</span><br><span class="line">    --version) version $0;;</span><br><span class="line">    *) copy=&quot;$copy $1&quot;; shift; ;;</span><br><span class="line">  esac</span><br><span class="line">done</span><br><span class="line"></span><br><span class="line">if [ $arg -ne 2 ];then</span><br><span class="line">number=1</span><br><span class="line">echo &quot;&quot;</span><br><span class="line">echo &quot;根据下面的提示，补全缺省的参数-ddrsize&quot;</span><br><span class="line">read -p &quot;请选择开发板参数，输入数字1|2，按Enter键确认</span><br><span class="line">1.-ddrsize 512</span><br><span class="line">2.-ddrsize 256</span><br><span class="line">输入数字1~4(default 1): &quot; number</span><br><span class="line">if [ -z $number ];then</span><br><span class="line">  echo &quot;使用默开发板参数DDR大小为512MB&quot;</span><br><span class="line">else</span><br><span class="line">  case $number in</span><br><span class="line">    1)  echo &#x27;您已经选择开发板参数为：DDR大小为512MB&#x27;</span><br><span class="line">        Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-nand.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    2)  echo &#x27;您已经选择开发板参数为：DDR大小为256MB&#x27;</span><br><span class="line">        Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-nand.imx&#x27;</span><br><span class="line">    ;;</span><br><span class="line">    *)  echo &#x27;输入的参数有误，退出烧写Nand Flash&#x27;;exit;</span><br><span class="line">    ;;</span><br><span class="line">esac</span><br><span class="line">fi</span><br><span class="line">else</span><br><span class="line">  if [ $ddrsize = &quot;512&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr512-nand.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：DDR大小为512MB&#x27;</span><br><span class="line">  elif [ $ddrsize = &quot;256&quot; ];then</span><br><span class="line">    Uboot=&#x27;u-boot-imx6ull-14x14-ddr256-nand.imx&#x27;</span><br><span class="line">    echo &#x27;您已经选择开发板参数为：DDR大小为256MB&#x27;</span><br><span class="line">  else</span><br><span class="line">    echo &#x27;参数有误!&#x27;</span><br><span class="line">    usage $0</span><br><span class="line">  fi</span><br><span class="line">fi</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">测试制卡包当前目录下是否缺失制卡所需要的文件</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash"><span class="built_in">test</span> -z <span class="variable">$device</span> &amp;&amp; usage <span class="variable">$0</span></span></span><br><span class="line">sdkdir=$PWD</span><br><span class="line"></span><br><span class="line">if [ ! -b /dev/mtdblock0 ]; then</span><br><span class="line">   echo &quot;错误: 你的设备不存在NandFlash&quot;</span><br><span class="line">   exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -d $sdkdir ]; then</span><br><span class="line">   echo &quot;错误: $sdkdir目录不存在&quot;</span><br><span class="line">   exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/filesystem/*.tar.* ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/filesystem/下找不到文件系统压缩包&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">if [ ! -f $sdkdir/boot/zImage ]; then</span><br><span class="line">  echo &quot;错误: $sdkdir/boot/下找不到zImage&quot;</span><br><span class="line">  exit 1</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;即将进行固化NandFlash系统，大约花费几分钟时间,请耐心等待!&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">echo &quot;*         注意：这将会清除NandFlash所有的数据              *&quot;</span><br><span class="line">echo &quot;*       在脚本执行时请勿断电或者中断烧写过程               *&quot;</span><br><span class="line">echo &quot;*             请按&lt;Enter&gt;确认继续                          *&quot;</span><br><span class="line">echo &quot;************************************************************&quot;</span><br><span class="line">read enter</span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">挂载debug，默认系统已经挂载</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">execute <span class="string">&quot;mount -t debugfs debugfs /sys/kernel/debug&quot;</span></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">烧写前，先使用指令flash_erase擦除各个分区</span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">NandFlash擦除是往设备里写<span class="string">&#x27;1&#x27;</span>，写数据是写<span class="string">&#x27;0&#x27;</span></span></span><br><span class="line"></span><br><span class="line">echo &quot;正在擦除Uboot分区...&quot;</span><br><span class="line">flash_erase /dev/mtd0 0 0</span><br><span class="line">echo &quot;正在烧写U-boot...&quot;</span><br><span class="line">kobs-ng init -x -v --chip_0_device_path=/dev/mtd0 $sdkdir/boot/$Uboot &gt;/dev/null 2&gt;&amp;1</span><br><span class="line"></span><br><span class="line">flash_erase /dev/mtd1 0 0</span><br><span class="line">flash_erase /dev/mtd2 0 0</span><br><span class="line"></span><br><span class="line">echo &quot;正在擦除设备树分区...&quot;</span><br><span class="line">flash_erase /dev/mtd3 0 0</span><br><span class="line">echo &quot;正在烧写设备树...&quot;</span><br><span class="line">nandwrite -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-4.3-480x272-c.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0x20000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-4.3-800x480-c.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0x40000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-7-800x480-c.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0x60000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-7-1024x600-c.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0x80000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-10.1-1280x800-c.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0xa0000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-hdmi.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line">nandwrite -s 0xc0000 -p /dev/mtd3 $sdkdir/boot/imx6ull-14x14-nand-vga.dtb &gt;/dev/null 2&gt;&amp;1</span><br><span class="line"></span><br><span class="line">echo &quot;正在擦除内核分区...&quot;</span><br><span class="line">flash_erase /dev/mtd4 0 0</span><br><span class="line">echo &quot;正在烧写内核...&quot;</span><br><span class="line">nandwrite -p /dev/mtd4 $sdkdir/boot/zImage &gt;/dev/null 2&gt;&amp;1</span><br><span class="line"></span><br><span class="line">echo &quot;正在擦除文件系统分区，请稍候...&quot;</span><br><span class="line">flash_erase /dev/mtd5 0 0</span><br><span class="line">ubiformat /dev/mtd5</span><br><span class="line">ubiattach /dev/ubi_ctrl -m 5</span><br><span class="line">ubimkvol /dev/ubi0 -Nrootfs -m</span><br><span class="line">mkdir -p /mnt/mtd5</span><br><span class="line">mount -t ubifs ubi0:rootfs /mnt/mtd5</span><br><span class="line">echo &quot;正在解压文件系统到mtd5分区，请稍候...&quot;</span><br><span class="line">tar jxfm $sdkdir/filesystem/*.tar.* -C /mnt/mtd5</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">判断是否存在这个目录，如果不存在就为文件系统创建一个modules目录</span></span><br><span class="line">if [ ! -e &quot;/mnt/mtd5/lib/modules&quot; ];then</span><br><span class="line">mkdir -p /mnt/mtd5/lib/modules</span><br><span class="line">fi</span><br><span class="line"></span><br><span class="line">echo &quot;正在解压模块到mtd5分区，请稍候...&quot;</span><br><span class="line">tar jxfm $sdkdir/modules/*.tar.* -C /mnt/mtd5/lib/modules</span><br><span class="line"></span><br><span class="line">sleep 1</span><br><span class="line">sync</span><br><span class="line">umount /mnt/mtd5</span><br><span class="line">rm -rf /mnt/mtd5</span><br><span class="line">ubidetach -p /dev/mtd5</span><br><span class="line">sync</span><br><span class="line"></span><br><span class="line">echo &quot;NandFlash启动系统烧写完成！&quot;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
              </div>
            </details>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/c60bf741.html">LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年09月08日 - 19:25</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/c60bf741.html" title="LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写">https://sumumm.github.io/post/c60bf741.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV01-IMX6ULL平台</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/7a886af.html" rel="prev" title="LV01-02-IMX6ULL-ALPHA开发板体验-04-基本功能测试">
                  <i class="fa fa-angle-left"></i> LV01-02-IMX6ULL-ALPHA开发板体验-04-基本功能测试
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/95616702.html" rel="next" title="LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介">
                  LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
